<?php
/**
 * OAuth_Response
 * 
 * This object is returned by the OAuth dispatcher object. It represents
 * the HTTP response object.
 * 
 * @package OAuth
 * @copyright Luke Visinoni (luke.visinoni@gmail.com)
 * @author Luke Visinoni (luke.visinoni@gmail.com)
 * @license GNU Lesser General Public License
 */
class OAuth_Response {

    /**
     * @var array Parameters returned in the response
     */
    protected $params = array();
    /**
     * @var array Headers returned in the response
     */
    protected $headers = array();
    /**
     * @var string The response status
     */
    protected $status = array();
    /**
     * @var string The response body
     */
    protected $body;
    /**
     * Set param
     */
    public function setParam($key, $value, $overwrite = true) {
    
        if ($overwrite) {
            $this->params[$param] = $value;
        }
    
    }
    /**
     * Set all params at once
     */
    public function setParams(array $params, $overwrite = true) {
    
        if ($overwrite) {
            $this->params = array_merge($this->params, $params);
        } else {
            $this->params = array_merge($params, $this->params);
        }
    
    }
    /**
     * Get Param
     */
    public function getParam($key) {
    
        // @todo: need to check that the param exists here... maybe an exception is thrown?
        return $this->params[$key];
    
    }
    /**
     * Get all parameters as an array
     */
    public function getParams() {
    
        return $this->params;
    
    }
    /**
     * Set the response headers
     */
    public function setHeaders(array $headers, $overwrite = true) {
    
        if ($overwrite) {
            $this->headers = array_merge($this->headers, $headers);
        } else {
            $this->headers = array_merge($headers, $this->headers);
        }
    
    }
    public function setHeader($header, $value, $overwrite) {
    
        if ($overwrite) {
            $this->headers[$header] = $value;
        }
    
    }
    /**
     * Get Header
     */
    public function getHeader($key) {

        // @todo: need to check that the param exists here... maybe an exception is thrown?
        return $this->headers[$key];

    }
    /**
     * Get all headers as an array
     */
    public function getHeaders() {

        return $this->headers;

    }
    /**
     * Set the response status
     */
    public function setStatus($status) {
    
        $this->status = $status;
    
    }
    /**
     * Sets and parses the response body
     */
    public function setBody($body) {
    
        // need to parse params here
    
    }

}